import type { TableColumn } from '@/framework/components/core/super-table';

export type TableListItem = { classify; value; createTime; status; createName };
export type TableColumnItem = TableColumn<TableListItem>;

const typeStatus = (num: 0 | 1) => {
  return num === 1 ? (
    // @ts-ignore
    <svg
      t='1680592527152'
      class='icon'
      viewBox='0 0 1024 1024'
      version='1.1'
      xmlns='http://www.w3.org/2000/svg'
      p-id='2909'
      width='75'
      height='20'
    >
      <path
        d='M512.024381 0C229.205333 0 0 229.205333 0 512.024381 0 794.770286 229.205333 1024 512.024381 1024 794.770286 1024 1024 794.770286 1024 512.024381 1024 229.205333 794.770286 0 512.024381 0M849.603048 353.328762l-385.462857 385.462857c-9.411048 9.411048-21.723429 14.09219-34.06019 14.09219s-24.697905-4.681143-34.084571-14.09219l-221.622857-221.647238c-18.822095-18.822095-18.822095-49.322667 0-68.120381 18.822095-18.846476 49.322667-18.846476 68.144762 0l187.562667 187.562667 351.378286-351.402667c18.822095-18.822095 49.322667-18.822095 68.144762 0C868.425143 304.006095 868.425143 334.506667 849.603048 353.328762'
        fill='#5bdc9c'
        p-id='2910'
        data-spm-anchor-id='a313x.7781069.0.i0'
        class=''
      ></path>
    </svg>
  ) : (
    // @ts-ignore
    <svg
      t='1680592590083'
      class='icon'
      viewBox='0 0 1024 1024'
      version='1.1'
      xmlns='http://www.w3.org/2000/svg'
      p-id='3923'
      width='75'
      height='22'
    >
      <path
        d='M512 981.333333C252.8 981.333333 42.666667 771.2 42.666667 512S252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333z m44.245333-469.333333l159.914667-159.914667a31.274667 31.274667 0 1 0-44.245333-44.245333L512 467.754667 352.085333 307.84a31.274667 31.274667 0 1 0-44.245333 44.245333L467.754667 512l-159.914667 159.914667a31.274667 31.274667 0 1 0 44.245333 44.245333L512 556.245333l159.914667 159.914667a31.274667 31.274667 0 1 0 44.245333-44.245333L556.245333 512z'
        fill='#F5222D'
        p-id='3924'
      ></path>
    </svg>
  );
};

export const baseColumns: TableColumnItem[] = [
  {
    type: 'seq',
    title: '序号',
    width: 60,
  },
  {
    title: '分类方法',
    field: 'classify',
  },
  {
    title: '样本类型',
    field: 'value',
    formatter: ({ cellValue }) => {
      return cellValue?.replaceAll('|', '、');
    },
  },
  {
    title: '创建人',
    field: 'createName',
  },

  {
    title: '创建时间',
    field: 'createTime',
    hideInSearch: true,
  },
  {
    title: '启用状态',
    field: 'status',
    hideInSearch: true,
    width: 100,
    slots: {
      default: ({ row }) => {
        return typeStatus(row.status);
      },
    },
  },
];
